home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / b / b.lha / B / src / bed / tabl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-24  |  1.1 KB  |  45 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
  2. /* $Header: tabl.h,v 2.0 84/06/18 15:47:24 guido Exp $ */
  3.  
  4. /*
  5.  * B editor -- Grammar table structure.
  6.  */
  7.  
  8.  
  9. typedef char classelem;
  10.     /* change into short if symbol or lexical values can exceed 127! */
  11.  
  12. typedef classelem *classptr;
  13.  
  14. struct classinfo {
  15.     classptr c_class; /* List of possible classes */
  16.         /* The following fields are initialized dynamically */
  17.     classptr c_insert; /* List of pairs (char, class) for insertion */
  18.     classptr c_append; /* Ditto for append to child already there */
  19.     classptr c_join; /* Ditto for join of child with new node */
  20. };
  21.  
  22. #define MAXCHILD 4 /* Max. # of children per node. */
  23.  
  24.  
  25. struct table {
  26.     short r_symbol; /* Redundant, used for checking consistency */
  27.     string r_name;
  28.     string r_repr[MAXCHILD+1];
  29.         /* There are entries [0..nch] inclusive. */
  30.     struct classinfo *r_class[MAXCHILD];
  31.         /* Must be indexed with [ich-1] !! */
  32.     node r_node;
  33. };
  34.  
  35. extern struct table *table;
  36.  
  37. #define TABLEN (Hole+1)
  38.  
  39. extern char code_array[];
  40. extern char invcode_array[];
  41. extern int lastcode;
  42.  
  43. #define Code(c) code_array[c]
  44. #define Invcode(code) invcode_array[code]
  45.